<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Mikrotik SMS</title>

        <!-- CSS -->
        <link href="<?php echo base_url() . 'assets/css/bootstrap.css'; ?>" rel="stylesheet" type="text/css" media="screen" />

        <!-- JavaScripts-->
        <script src="<?php echo base_url() . 'assets/js/jquery.min.js'; ?>"></script>
        <script type="text/javascript" src="<?php echo base_url() . 'assets/js/bootstrap.js'; ?>"></script>
    </head>

    <body>
        <div id="wrapper">
            <!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
            <div id="container">
                <div class="well"<h1>SMS Gateway Mikrotik</h1></div>
            </div>
            <div id="container">
                <div id="container">
                    <?php $this->load->view('sidebar'); ?>    
                    <!-- // #sidebar -->
                    <div class="span10 well">
                        <legend><h3>User</h3></legend>
                        <a href="#myModal" role="button" class="btn" data-toggle="modal"><i class="icon-user"></i>Add User</a>

                        <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4>Tambah User Baru</h4>
                            </div>
                            <div class="modal-body">
                                <?php
                                $f = array('class' => 'form-horizontal');
                                echo form_open('user/tambahUser', $f);
                                ?>
                                <div class="control-group">
                                    <label class="control-label" for="username">username</label>
                                    <div class="controls">
                                        <input type="text" id="username" placeholder="username" name="username">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="inputPassword">Password</label>
                                    <div class="controls">
                                        <input type="password" id="inputPassword" placeholder="Password" name="password">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="group">Mikrotik Profile</label>
                                    <div class="controls">
                                        <input type="text" id="group" placeholder="Profile" name="profile" value="<?
                                        if ('NULL') {
                                            echo "default";
                                        }
                                        ?>">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="masaAktif">Masa Aktif</label>
                                    <div class="controls">
                                        <input type="text" id="masaAktif" placeholder="Masa Aktif" name="masaAktif">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="telepon">Nomor HP</label>
                                    <div class="controls">
                                        <input type="text" id="telepon" placeholder="No HP" name="no" value="+62">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <div class="controls">
                                        <button type="submit" class="btn" name="daftar" value="daftar">Daftar</button>
                                    </div>
                                </div>
                                <?php echo form_close(); ?>
                            </div>
                        </div>
                        <div class="clear">&nbsp;</div>
                        <?
                        if (isset($isi)) {
                            $link = "<a href=" . site_url() . 'user/hapusSemua' . "><div class=" . '"btn btn-danger"' . " onClick=" . '"return confirm(' . "'Apa Anda yakin akan menghapus semua data?'" . ")" . '">Kosongkan Data</div></a><br>';
                            echo $link;
                            ?>
                            <? echo "<h4>User Berhasil Ditambahkan</h4>"; ?>
                            <table class="table table-bordered">
                                <th>Nama</th>
                                <th>Masa Aktif</th>
                                <th>No hape</th>
                                <th>Action</th>
                                <?
                                foreach ($table as $nganu) {
                                    if ($nganu->attribute == 'Expiration') {
                                        ?>
                                        <tr>
                                            <td width="40%"><?php echo $nganu->username; ?></td>
                                            <td width="30%"><?php echo $nganu->value; ?></td>
                                            <td width="30%">
                                                <?
                                                foreach ($telpon as $tlp) {
                                                    if ($tlp->username == $nganu->username)
                                                        echo $tlp->telpon;
                                                }
                                                ?>
                                            </td>
                                            <td><center><a href="<? echo site_url() . "user/hapusUser/" . $nganu->id; ?>"><img src="<?php echo base_url() . 'assets/img/delete.png' ?>" alt="hapus"></a></center></td>
                                        </tr>
                                        <?
                                    } else {
                                        NULL;
                                    }
                                }
                                echo $links;
                            } else {
                                echo "<br><div class='alert alert-success'>Data Pelanggan Berhasil Dikosongkan<br></div>";
                                echo "<div class='alert alert-error'>Data Pelanggan Kosong</div>";
                            }
                            ?>
                        </table>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>	
        </div>
    </body>
</html>


















